package com.libraryManage.mapper;

import com.libraryManage.entity.BorrowDo;
import com.libraryManage.entity.BorrowingUser;
import com.libraryManage.vo.BorrowVo;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.Date;
import java.util.List;
@Repository
public interface BorrowDoMapper {
    int deleteByPrimaryKey(Integer id);

    int insert(BorrowDo record);

    int insertSelective(BorrowDo record);

    BorrowDo selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(BorrowDo record);

    int updateByPrimaryKey(BorrowDo record);

    List<BorrowDo> findAll();

    /**
     * 查询借阅记录
     * @param vo
     * @return
     */
    List<BorrowVo> getList(BorrowVo vo);

    /**
     * 获取未处理预约借阅列表
     * @param borrowingUser
     * @return
     */
    List<BorrowingUser> getBorrowingUser(BorrowingUser borrowingUser);

    /**
     * 新增借阅记录
     * @param userId
     * @param bookId
     * @param start
     * @param end
     */
    void addBorrow(@Param("userId") int userId,@Param("bookId") int bookId,@Param("start") Date start,@Param("end") Date end);

    /**
     * 更新预约借阅记录
     * @param userId
     * @param borrowingState
     */
    void updateBorrowingState(@Param("userId")int userId,@Param("state") int borrowingState);
}
